{include file="Index/header" /}

<body>
	<div class="formbody">
	<div class="formtitle"><span>商品分类管理</span></div>
		<div id="usual1" class="usual">
			<div id="tab2" class="tabson">
					<ul class="seachform hide_part" >
						<li><label>商品类型</label>
							<input type="text" class="scinput" id="names" /> 
						</li> 
						<li><label>&nbsp;</label>
							<input name="query" type="button" class="btn" value="添加分类"  id="add_tag" onclick="addCategory()"/>
						</li>
					</ul>
				<div id="ajax_dom">
						<table class="tablelist" >
							<thead>
								<tr>
									<th>商品类型</th> 
									<th>操作</th>
								</tr>
							</thead>
							<tbody id="tbody">
									{volist name="listArr" id="vo" key="k" } 
								<tr id="tr_{$vo.id}">
									<td>{$vo.names}</td>
									<td>
										<a href="javascript:void(0);" data="{:url('Goods/categoryEdit',['cid'=>$vo['id']])}" class="tablelink" onclick="editCategory(this)">编辑</a> 
										<a href="{:url('Goods/categoryDelete',['cid'=>$vo['id']])}" class="tablelink" >删除</a></td>
								</tr>
								{/volist} 
							</tbody>
						</table>
						
				</div>
			</div>
		</div>
	</div>


<script>
/*添加*/
function addCategory(){
	var txt_tag = $("#names").val();
	if (txt_tag){
		$.post('{:url("Goods/categoryAdd")}',{
				'names':$("#names").val()
			},function(json){
				
			if(json.status=="1"){ 
				art.dialog.tips('添加成功');
				$("#tbody").append(json.data);
			} 
			
		},'json');
	}else{
		window.parent.callNotice('请输入商品分类');
	}
	
}

/*编辑  */
function editCategory(obj){
	art.dialog.open($(obj).attr("data"),{title:"商品类型修改",close:function (){
		 if(art.dialog.data('op')=='ok'){  
			 art.dialog.tips('修改成功'); 
	 		 location.href=location.href;
			 
		 }
		
	 }},false);
}
 





</script>
{include file="Index/footer" /}











